package com.android.mail;

import android.content.Context;
import android.net.ConnectivityManager;


public class NetworkUitl {
	 public static final int NETWORK_WIFI = 0; 
	 public static final int NETWORK_3G = 1;  
	 public static final int TYPE_WIMAX = 6;  
	 public static final int NETWORK_NONE = 2;   
	 public static int checkStatus(Context context)  
	 {    final ConnectivityManager connMgr = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);   
	 final android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
	 final android.net.NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
	 //final android.net.NetworkInfo wimax = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIMAX); 
		 if(wifi.isAvailable()){ 
			 return NETWORK_WIFI;    
		 }else if(mobile.isAvailable()){ 
			 return NETWORK_3G;    
//		 }else if(wimax.isAvailable()){ 
//			 return TYPE_WIMAX;    
		 }else{
			 return NETWORK_NONE; 
		 }
	 }
}
